#include <QtQml>
#include <QGuiApplication>
#include <QQmlApplicationEngine>

#include <QJsonDocument>
#include <QProcess>

int main(int argc, char *argv[])
{
    QGuiApplication app(argc, argv);
    qDebug()<<"123";
    QProcess p;
    p.start("./DxOFDViewer.exe");
    QObject::connect(&p,&QProcess::readyRead,[&](){
        qDebug()<<p.readAll();
    });
    p.waitForFinished();

    QQmlApplicationEngine engine;
    const QUrl url(u"qrc:/qml/main.qml"_qs);
    QObject::connect(
        &engine,
        &QQmlApplicationEngine::objectCreated,
        &app,
        [url](QObject *obj, const QUrl &objUrl) {
            if (!obj && url == objUrl)
                QCoreApplication::exit(-1);
        },
        Qt::QueuedConnection);

    engine.addImportPath("./plugins");
    engine.addImportPath(":/");

    engine.load(url);

    return app.exec();
}
